#include<stdio.h>
#include<stdlib.h>
#include<errno.h>
int main(int argc,char **argv)
{
		int tmp;
		int count=0,lines=0;
		FILE *fps,*fpd;
		fps=fopen(argv[1],"rb");
		if(fps==NULL)
		{
				perror("open failde");
				return -1;
		}
		fpd=fopen(argv[2],"wb");
		if(fpd==NULL)
		{
				perror("file failed");
				return -1;
		}
    
		while(1)
		{
			tmp=fgetc(fps);
			if(tmp==EOF)
					break;
			if(tmp=='\n')
				lines++;
			fputc(tmp,fpd);
			count++;
		}
		
		printf("复制文件的字符数=%d\n",count);
		printf("复制文件的行数=%d\n",lines);
		fclose(fps);
		fclose(fpd);
    return 0;
}
